feat(langchain): add ToonSerializer and ToonOutputParser#45
Open
Ansarafsar wants to merge 4 commits intotoon-format:mainfrom
Open
feat(langchain): add ToonSerializer and ToonOutputParser#45Ansarafsar wants to merge 4 commits intotoon-format:mainfrom
Ansarafsar wants to merge 4 commits intotoon-format:mainfrom
Conversation
Author
|
PR ready for review!
This is the #1 requested feature for RAG/agent developers who want cheaper prompts. Happy to add benchmarks, more tests, or a docs page if needed — just let me know! Thanks for the quick review |
johannschopplich
requested changes
Nov 27, 2025
Co-authored-by: Johann Schopplich <johann@schopplich.com>
Added LangChain integration details and usage examples.
johannschopplich
approved these changes
Nov 28, 2025
Contributor
johannschopplich
left a comment
There was a problem hiding this comment.
Thanks for the updates LGTM (README-wise). As for the code and usefulness, @toon-format/python-maintainers shall decide. :)
Author
|
Thanks for the approval Johann :)
…On Fri, 28 Nov 2025, 12:09 pm Johann Schopplich, ***@***.***> wrote:
***@***.**** approved this pull request.
Thanks for the updates LGTM (README-wise). As for the code and usefulness,
@toon-format/python-maintainers
<https://github.com/orgs/toon-format/teams/python-maintainers> shall
decide. :)
—
Reply to this email directly, view it on GitHub
<#45 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT5UVZF7F3C6SRIGYBLDAVT367U2TAVCNFSM6AAAAACNMWFKA6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKMJXGY2DAOBXGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Author
|
Hi @toon-format/python-maintainers just a small follow up request on merging the PR :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an optional LangChain integration as an extra dependency. Users can install with
pip install "toon-python[langchain]"and usefrom toon_format.langchain import ToonSerializerto convert Documents to compact TOON format, saving 30-60% tokens in RAG and agent prompts.Type of Change
Related Issues
Closes # (no issue yet, this is the first LangChain request)
Changes Made
src/toon_format/langchain/withToonSerializerandToonOutputParsertests/test_langchain.pywith 2 tests[langchain]extra inpyproject.tomlSPEC Compliance
Testing
Test Output
Code Quality
ruff check src/toon_format tests- no issuesruff format src/toon_format tests- code formattedmypy src/toon_format- no critical errorspytest tests/ -vChecklist
Performance Impact
Breaking Changes
Screenshots / Examples
Output:
Additional Context
This is a fully optional integration. Core users are unaffected. After the next release, LangChain developers can save significant tokens in prompts with just one line of code.
Checklist for Reviewers